Optimal. Leaf size=88 \[ \frac {x}{4}-\frac {\sin (2 a+2 b x)}{8 b}+\frac {\sin (2 (a-c)+2 (b-d) x)}{16 (b-d)}-\frac {\sin (2 c+2 d x)}{8 d}+\frac {\sin (2 (a+c)+2 (b+d) x)}{16 (b+d)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 2, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {4665, 2717}
\begin {gather*} \frac {\sin (2 (a-c)+2 x (b-d))}{16 (b-d)}+\frac {\sin (2 (a+c)+2 x (b+d))}{16 (b+d)}-\frac {\sin (2 a+2 b x)}{8 b}-\frac {\sin (2 c+2 d x)}{8 d}+\frac {x}{4} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2717
Rule 4665
Rubi steps
\begin {align*} \int \sin ^2(a+b x) \sin ^2(c+d x) \, dx &=\int \left (\frac {1}{4}-\frac {1}{4} \cos (2 a+2 b x)+\frac {1}{8} \cos (2 (a-c)+2 (b-d) x)-\frac {1}{4} \cos (2 c+2 d x)+\frac {1}{8} \cos (2 (a+c)+2 (b+d) x)\right ) \, dx\\ &=\frac {x}{4}+\frac {1}{8} \int \cos (2 (a-c)+2 (b-d) x) \, dx+\frac {1}{8} \int \cos (2 (a+c)+2 (b+d) x) \, dx-\frac {1}{4} \int \cos (2 a+2 b x) \, dx-\frac {1}{4} \int \cos (2 c+2 d x) \, dx\\ &=\frac {x}{4}-\frac {\sin (2 a+2 b x)}{8 b}+\frac {\sin (2 (a-c)+2 (b-d) x)}{16 (b-d)}-\frac {\sin (2 c+2 d x)}{8 d}+\frac {\sin (2 (a+c)+2 (b+d) x)}{16 (b+d)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.83, size = 106, normalized size = 1.20 \begin {gather*} \frac {\left (-2 b^2 d+2 d^3\right ) \sin (2 (a+b x))+b d (b+d) \sin (2 (a-c+(b-d) x))+b (b-d) (-2 (b+d) \sin (2 (c+d x))+d (4 (b+d) x+\sin (2 (a+c+(b+d) x))))}{16 b (b-d) d (b+d)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.18, size = 83, normalized size = 0.94
method | result | size |
default | \(\frac {x}{4}-\frac {\sin \left (2 b x +2 a \right )}{8 b}-\frac {\sin \left (2 d x +2 c \right )}{8 d}+\frac {\sin \left (\left (2 b -2 d \right ) x +2 a -2 c \right )}{16 b -16 d}+\frac {\sin \left (\left (2 b +2 d \right ) x +2 a +2 c \right )}{16 b +16 d}\) | \(83\) |
risch | \(\frac {x}{4}-\frac {\sin \left (2 b x +2 a \right )}{8 b}-\frac {\sin \left (2 d x +2 c \right ) b^{2}}{8 d \left (b -d \right ) \left (b +d \right )}+\frac {d \sin \left (2 d x +2 c \right )}{8 \left (b -d \right ) \left (b +d \right )}+\frac {\sin \left (2 b x -2 d x +2 a -2 c \right ) b}{16 \left (b -d \right ) \left (b +d \right )}+\frac {d \sin \left (2 b x -2 d x +2 a -2 c \right )}{16 \left (b -d \right ) \left (b +d \right )}+\frac {\sin \left (2 b x +2 d x +2 a +2 c \right ) b}{16 \left (b -d \right ) \left (b +d \right )}-\frac {d \sin \left (2 b x +2 d x +2 a +2 c \right )}{16 \left (b -d \right ) \left (b +d \right )}\) | \(196\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 620 vs.
\(2 (78) = 156\).
time = 0.31, size = 620, normalized size = 7.05 \begin {gather*} \frac {8 \, {\left ({\left (b \cos \left (2 \, c\right )^{2} + b \sin \left (2 \, c\right )^{2}\right )} d^{3} - {\left (b^{3} \cos \left (2 \, c\right )^{2} + b^{3} \sin \left (2 \, c\right )^{2}\right )} d\right )} x + {\left (b^{2} d \sin \left (2 \, c\right ) - b d^{2} \sin \left (2 \, c\right )\right )} \cos \left (2 \, {\left (b + d\right )} x + 2 \, a + 4 \, c\right ) - {\left (b^{2} d \sin \left (2 \, c\right ) - b d^{2} \sin \left (2 \, c\right )\right )} \cos \left (2 \, {\left (b + d\right )} x + 2 \, a\right ) - {\left (b^{2} d \sin \left (2 \, c\right ) + b d^{2} \sin \left (2 \, c\right )\right )} \cos \left (-2 \, {\left (b - d\right )} x - 2 \, a + 4 \, c\right ) + {\left (b^{2} d \sin \left (2 \, c\right ) + b d^{2} \sin \left (2 \, c\right )\right )} \cos \left (-2 \, {\left (b - d\right )} x - 2 \, a\right ) - 2 \, {\left (b^{2} d \sin \left (2 \, c\right ) - d^{3} \sin \left (2 \, c\right )\right )} \cos \left (2 \, b x + 2 \, a + 2 \, c\right ) + 2 \, {\left (b^{2} d \sin \left (2 \, c\right ) - d^{3} \sin \left (2 \, c\right )\right )} \cos \left (2 \, b x + 2 \, a - 2 \, c\right ) + 2 \, {\left (b^{3} \sin \left (2 \, c\right ) - b d^{2} \sin \left (2 \, c\right )\right )} \cos \left (2 \, d x\right ) - 2 \, {\left (b^{3} \sin \left (2 \, c\right ) - b d^{2} \sin \left (2 \, c\right )\right )} \cos \left (2 \, d x + 4 \, c\right ) - {\left (b^{2} d \cos \left (2 \, c\right ) - b d^{2} \cos \left (2 \, c\right )\right )} \sin \left (2 \, {\left (b + d\right )} x + 2 \, a + 4 \, c\right ) - {\left (b^{2} d \cos \left (2 \, c\right ) - b d^{2} \cos \left (2 \, c\right )\right )} \sin \left (2 \, {\left (b + d\right )} x + 2 \, a\right ) + {\left (b^{2} d \cos \left (2 \, c\right ) + b d^{2} \cos \left (2 \, c\right )\right )} \sin \left (-2 \, {\left (b - d\right )} x - 2 \, a + 4 \, c\right ) + {\left (b^{2} d \cos \left (2 \, c\right ) + b d^{2} \cos \left (2 \, c\right )\right )} \sin \left (-2 \, {\left (b - d\right )} x - 2 \, a\right ) + 2 \, {\left (b^{2} d \cos \left (2 \, c\right ) - d^{3} \cos \left (2 \, c\right )\right )} \sin \left (2 \, b x + 2 \, a + 2 \, c\right ) + 2 \, {\left (b^{2} d \cos \left (2 \, c\right ) - d^{3} \cos \left (2 \, c\right )\right )} \sin \left (2 \, b x + 2 \, a - 2 \, c\right ) + 2 \, {\left (b^{3} \cos \left (2 \, c\right ) - b d^{2} \cos \left (2 \, c\right )\right )} \sin \left (2 \, d x\right ) + 2 \, {\left (b^{3} \cos \left (2 \, c\right ) - b d^{2} \cos \left (2 \, c\right )\right )} \sin \left (2 \, d x + 4 \, c\right )}{32 \, {\left ({\left (b \cos \left (2 \, c\right )^{2} + b \sin \left (2 \, c\right )^{2}\right )} d^{3} - {\left (b^{3} \cos \left (2 \, c\right )^{2} + b^{3} \sin \left (2 \, c\right )^{2}\right )} d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.07, size = 118, normalized size = 1.34 \begin {gather*} -\frac {{\left (2 \, b d^{2} \cos \left (b x + a\right )^{2} + b^{3} - 2 \, b d^{2}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) - {\left (b^{3} d - b d^{3}\right )} x - {\left (2 \, b^{2} d \cos \left (b x + a\right ) \cos \left (d x + c\right )^{2} - {\left (2 \, b^{2} d - d^{3}\right )} \cos \left (b x + a\right )\right )} \sin \left (b x + a\right )}{4 \, {\left (b^{3} d - b d^{3}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 1027 vs.
\(2 (76) = 152\).
time = 1.93, size = 1027, normalized size = 11.67 \begin {gather*} \begin {cases} x \sin ^{2}{\left (a \right )} \sin ^{2}{\left (c \right )} & \text {for}\: b = 0 \wedge d = 0 \\\left (\frac {x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {x \cos ^{2}{\left (c + d x \right )}}{2} - \frac {\sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d}\right ) \sin ^{2}{\left (a \right )} & \text {for}\: b = 0 \\\frac {3 x \sin ^{2}{\left (a - d x \right )} \sin ^{2}{\left (c + d x \right )}}{8} + \frac {x \sin ^{2}{\left (a - d x \right )} \cos ^{2}{\left (c + d x \right )}}{8} - \frac {x \sin {\left (a - d x \right )} \sin {\left (c + d x \right )} \cos {\left (a - d x \right )} \cos {\left (c + d x \right )}}{2} + \frac {x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (a - d x \right )}}{8} + \frac {3 x \cos ^{2}{\left (a - d x \right )} \cos ^{2}{\left (c + d x \right )}}{8} - \frac {\sin ^{2}{\left (a - d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {\sin {\left (a - d x \right )} \sin ^{2}{\left (c + d x \right )} \cos {\left (a - d x \right )}}{8 d} + \frac {3 \sin {\left (a - d x \right )} \cos {\left (a - d x \right )} \cos ^{2}{\left (c + d x \right )}}{8 d} & \text {for}\: b = - d \\\frac {3 x \sin ^{2}{\left (a + d x \right )} \sin ^{2}{\left (c + d x \right )}}{8} + \frac {x \sin ^{2}{\left (a + d x \right )} \cos ^{2}{\left (c + d x \right )}}{8} + \frac {x \sin {\left (a + d x \right )} \sin {\left (c + d x \right )} \cos {\left (a + d x \right )} \cos {\left (c + d x \right )}}{2} + \frac {x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (a + d x \right )}}{8} + \frac {3 x \cos ^{2}{\left (a + d x \right )} \cos ^{2}{\left (c + d x \right )}}{8} - \frac {5 \sin {\left (a + d x \right )} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + d x \right )}}{8 d} + \frac {\sin {\left (a + d x \right )} \cos {\left (a + d x \right )} \cos ^{2}{\left (c + d x \right )}}{8 d} - \frac {\sin {\left (c + d x \right )} \cos ^{2}{\left (a + d x \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: b = d \\\left (\frac {x \sin ^{2}{\left (a + b x \right )}}{2} + \frac {x \cos ^{2}{\left (a + b x \right )}}{2} - \frac {\sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{2 b}\right ) \sin ^{2}{\left (c \right )} & \text {for}\: d = 0 \\\frac {b^{3} d x \sin ^{2}{\left (a + b x \right )} \sin ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} + \frac {b^{3} d x \sin ^{2}{\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} + \frac {b^{3} d x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (a + b x \right )}}{4 b^{3} d - 4 b d^{3}} + \frac {b^{3} d x \cos ^{2}{\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {b^{3} \sin ^{2}{\left (a + b x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {b^{3} \sin {\left (c + d x \right )} \cos ^{2}{\left (a + b x \right )} \cos {\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {2 b^{2} d \sin {\left (a + b x \right )} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + b x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {b d^{3} x \sin ^{2}{\left (a + b x \right )} \sin ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {b d^{3} x \sin ^{2}{\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {b d^{3} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (a + b x \right )}}{4 b^{3} d - 4 b d^{3}} - \frac {b d^{3} x \cos ^{2}{\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} + \frac {2 b d^{2} \sin ^{2}{\left (a + b x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} + \frac {d^{3} \sin {\left (a + b x \right )} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + b x \right )}}{4 b^{3} d - 4 b d^{3}} + \frac {d^{3} \sin {\left (a + b x \right )} \cos {\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{4 b^{3} d - 4 b d^{3}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 80, normalized size = 0.91 \begin {gather*} \frac {1}{4} \, x + \frac {\sin \left (2 \, b x + 2 \, d x + 2 \, a + 2 \, c\right )}{16 \, {\left (b + d\right )}} + \frac {\sin \left (2 \, b x - 2 \, d x + 2 \, a - 2 \, c\right )}{16 \, {\left (b - d\right )}} - \frac {\sin \left (2 \, b x + 2 \, a\right )}{8 \, b} - \frac {\sin \left (2 \, d x + 2 \, c\right )}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.89, size = 177, normalized size = 2.01 \begin {gather*} \frac {2\,d^3\,\sin \left (2\,a+2\,b\,x\right )-2\,b^3\,\sin \left (2\,c+2\,d\,x\right )+b\,d^2\,\sin \left (2\,a-2\,c+2\,b\,x-2\,d\,x\right )-b\,d^2\,\sin \left (2\,a+2\,c+2\,b\,x+2\,d\,x\right )+b^2\,d\,\sin \left (2\,a-2\,c+2\,b\,x-2\,d\,x\right )+b^2\,d\,\sin \left (2\,a+2\,c+2\,b\,x+2\,d\,x\right )-2\,b^2\,d\,\sin \left (2\,a+2\,b\,x\right )+2\,b\,d^2\,\sin \left (2\,c+2\,d\,x\right )-4\,b\,d^3\,x+4\,b^3\,d\,x}{16\,b\,d\,\left (b^2-d^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________